/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package datas;

import beans.Detail;
import java.sql.CallableStatement;
import java.sql.SQLException;

/**
 *
 * @author havn
 */
public class OrderDetailObj {

    private connector con;
    //private List<Product> products;

    public OrderDetailObj() {
        con = new connector();
        //products = listProduct();
    }

    public boolean InsertDetail(Detail d) {
        try {
            CallableStatement call = con.getCon().prepareCall("{call InsertDetail(?,?,?)}");
            call.setString(1, d.getOrderCode());
            call.setInt(2, d.getProductId());
            call.setInt(3, d.getQuanlity());
            if (call.executeUpdate() > 0) {
                return true;
            } else {
                return false;
            }
        } catch (SQLException ex) {
            ex.getStackTrace();
        }
        return false;
    }
}
